/*
 * @Author: Olivia
 * @Date: 2022-07-03 23:22:05
 * @LastEditTime: 2022-07-06 23:33:47
 * @FilePath: \toutiao-m\src\utils\dayjs.js
 * @custom_string_Olivia: Less is more
 */
import Vue from 'vue'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'

import relativeTime from 'dayjs/plugin/relativeTime' // ES 2015
dayjs.extend(relativeTime)

dayjs.locale('zh-cn')
Vue.filter('relativeTime', value => {
  return dayjs().to(dayjs(value)) // 2 years ago
})
